<template>
	<view class="personalInfo plr15 ">
		<view class="header">
		 
		</view>
		<view class="personalBox bgWhite radius8">
            
			<uv-form labelPosition="left" :model="personaModel" :rules="personalRules" ref="form">
            
                <uv-form-item label="姓名" required  borderBottom  labelWidth="120rpx">
                	<uv-input v-model="personaModel.realname" border="none" placeholder="请输入您的姓名" >
                	</uv-input>
                </uv-form-item>
				<uv-form-item label="手机号"  borderBottom  labelWidth="120rpx">
					<uv-input v-model="personaModel.phone" type="number" border="none" placeholder="请输入您的手机号" >
					</uv-input>
				</uv-form-item>
				
                <uv-form-item label="身份证号"  borderBottom  labelWidth="120rpx">
                	<uv-input v-model="personaModel.id_number" type="number" border="none" placeholder="请输入您的身份证号" >
                	</uv-input>
                </uv-form-item>
				
			</uv-form>
		</view>
		
			<view class="save_btn" @click="save">
				保存
			</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				personaModel: {
					phone:"",
                    user_id:uni.getStorageSync('userId'),
					id_number:"",
                    realname:"",
                    
				},
				personalRules: {},
                areaRrand: [
                    [],
                    []
                ],
                columnData:[],
                area:"",
                checkboxValue:[]
			};
		},
        onReady() {
               
        },
		onLoad() {
          if(!uni.getStorageSync('userId')){
              uni.showToast({
                  title:'未登录,请先登录',
                  icon:"none"
              })
              setTimeout(()=>{
                    uni.reLaunch({
                        url:'/pages/login/login'
                    })
              },800)
          }
		  
		},
		methods: {
            
			async save(){
                
                if(!this.personaModel.realname) return this.$utils.msg('请输入姓名')
                // if(!this.$uv.test.idCard(this.personaModel.cardID)) return this.$utils.msg('请输入正确的身份证号')
                  const res = await this.$api.addVenuePerson(this.personaModel)
                  
                  if(res.code==200){
                      this.$utils.msg('操作成功')
					  uni.$emit('getPointer',{
						appointer_id:res.appointer_id,
						realname:this.personaModel.realname,
						phone:this.personaModel.phone,
					  })
                      setTimeout(()=>{
                          uni.navigateBack()
                      },800)
                  }else{
                      this.$utils.msg(res.msg)
                  }
            }
		}
	}
</script>

<style lang="scss" scoped>
        
    .header{
        margin-bottom: 44rpx;
        font-size: 28rpx;
        color: #666666;
        .notice{
            margin: 64rpx 0 20rpx;
            font-size: 48rpx;
            color: #000000;
            line-height: 54rpx;    
        }
      
    }
	.personalInfo {
		
		
        position: relative;
		.personalBox {
			padding:40rpx 48rpx 62rpx 48rpx;
			text-align: center;
			image{
				width: 136rpx;
			}
            
		}
		
			.save_btn{
				width: 100%;
				height: 90rpx;
                margin-top: 52rpx;
                margin-bottom: 40rpx;
				background: #2CC6A1;
				border-radius: 8rpx;
				font-size: 32rpx;
				color: #FFFFFF;
				text-align: center;
				line-height: 90rpx;
			}
		
	}
</style>